package com.ruoyi.system.service.impl;

import java.util.List;
import com.ruoyi.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.system.mapper.MaterialStockMapper;
import com.ruoyi.system.domain.MaterialStock;
import com.ruoyi.system.service.IMaterialStockService;

/**
 * 物资库存Service业务层处理
 * 
 * @author ruoyi
 * @date 2025-03-11
 */
@Service
public class MaterialStockServiceImpl implements IMaterialStockService 
{
    @Autowired
    private MaterialStockMapper materialStockMapper;

    /**
     * 查询物资库存
     * 
     * @param materialId 物资库存主键
     * @return 物资库存
     */
    @Override
    public MaterialStock selectMaterialStockByMaterialId(Long materialId)
    {
        return materialStockMapper.selectMaterialStockByMaterialId(materialId);
    }

    /**
     * 查询物资库存列表
     * 
     * @param materialStock 物资库存
     * @return 物资库存
     */
    @Override
    public List<MaterialStock> selectMaterialStockList(MaterialStock materialStock)
    {
        return materialStockMapper.selectMaterialStockList(materialStock);
    }

    /**
     * 新增物资库存
     * 
     * @param materialStock 物资库存
     * @return 结果
     */
    @Override
    public int insertMaterialStock(MaterialStock materialStock)
    {
        return materialStockMapper.insertMaterialStock(materialStock);
    }

    /**
     * 修改物资库存
     * 
     * @param materialStock 物资库存
     * @return 结果
     */
    @Override
    public int updateMaterialStock(MaterialStock materialStock)
    {
        materialStock.setUpdateTime(DateUtils.getNowDate());
        return materialStockMapper.updateMaterialStock(materialStock);
    }

    /**
     * 批量删除物资库存
     * 
     * @param materialIds 需要删除的物资库存主键
     * @return 结果
     */
    @Override
    public int deleteMaterialStockByMaterialIds(Long[] materialIds)
    {
        return materialStockMapper.deleteMaterialStockByMaterialIds(materialIds);
    }

    /**
     * 删除物资库存信息
     * 
     * @param materialId 物资库存主键
     * @return 结果
     */
    @Override
    public int deleteMaterialStockByMaterialId(Long materialId)
    {
        return materialStockMapper.deleteMaterialStockByMaterialId(materialId);
    }
}
